package com.tianyu.jty.activiti.util;

import org.apache.log4j.Logger;

public class Converter {

    private static final Logger logger = Logger.getLogger(Converter.class);

    public static double toDecimal(Object o) {
        String v = String.valueOf(o);

        try {
            return Double.parseDouble(v);
        } catch (NumberFormatException var3) {
            return 0.0D;
        }
    }

    public static final String toString(Object o) {
        return o == null ? "" : o.toString();
    }

    public static int toInt(Object o) {
        String v = String.valueOf(o);

        try {
            return Integer.parseInt(v, 10);
        } catch (NumberFormatException var3) {
            return 0;
        }
    }

    public static long toLong(Object o) {
        String v = String.valueOf(o);

        try {
            return Long.parseLong(v, 10);
        } catch (NumberFormatException var3) {
            return 0L;
        }
    }
}
